#include<stdio.h> 
#include<stdlib.h> 
struct face 
{ 
 int num; 
 int m; 
 struct face *next; 
}; 
 struct face card [52],save[10]; 
 struct face *p0; 
 int n=0,com,you,bet; 
main() 
{ 
  int i,j,k,x,ret; 
  struct face *p; 
  char ch='y',c,a='y',b='y'; 
  void pap(int,int,int,int); 
  int compar1(struct face *); 
  int compar2(struct face *); 
  int compar3(struct face *); 
  int compar4(struct face *); 
  void compar5(struct face *); 
  void fen(); 
  void serve(); 
  void puke1(); 
  start:textbackground(0); 
  clrscr(); 
  puke1(); 
  c=getch(); 
  textbackground(0); 
  clrscr(); 
  gotoxy(22,12); 
  printf("do you want to start the game?(y/n)"); 
  b=getch(); 
  if(b=='n') 
    exit(0); 
  com=5000; 
  you=5000; 
  n=0; 

  while(ch!='n') 
  { 
    if(com<500) 
    { 
      clrscr(); 
      gotoxy(23,1); 
      printf("the computer donot have enough money"); 
      gotoxy(36,2); 
      printf("YOU WIN"); 
      gotoxy(30,3); 
      printf("start new game?(y/n)"); 
      a=getch(); 
      if(a!='n') 
goto start; 
      else 
exit(0); 
    } 
    if(you<500) 
    { 
      clrscr(); 
      gotoxy(30,1); 
      printf("you donot have enough money"); 
      gotoxy(36,2); 
      printf("YOU LOSE"); 
      gotoxy(30,3); 
      printf("start new game?(y/n)"); 
      a=getch(); 
      if(a!=n) 
goto start; 
      else 
exit(0); 
    } 
    textbackground(0); 
    serve(); 
    bet=0; 
    ret=0; 
    p=save; 
    clrscr(); 
    k=12; 
    fen(); 
    pap(0,3,9,0); 
    pap(0,4,9,12); 
    gotoxy(50,1); 
    printf("the basic money 20"); 
    com=com-20; 
    you=you-20; 
    bet=40; 
    fen(); 
    p=p->next; 
    i=p->num; 
    j=p->m; 
    gotoxy(55,18); 
    printf("YOUR:"); 
    pap(i,j,60,12); 
    p=p->next; 
    sleep(2); 
    /*            */ 
      i=p->num; 
      j=p->m; 
      pap(i,j,k,0); 
      p=p->next; 
      i=p->num; 
      j=p->m; 
      pap(i,j,k,12); 
      p=p->next; 
      k+=3; 
      ret=compar1(save); 
      fen(); 
      if(ret==1) 
 goto end; 


      i=p->num; 
      j=p->m; 
      pap(i,j,k,0); 
      p=p->next; 
      i=p->num; 
      j=p->m; 
      pap(i,j,k,12); 
      k+=3; 
      p=p->next; 
      ret=compar2(save); 
      fen(); 
      if(ret==1) 
goto end; 


      i=p->num; 
      j=p->m; 
      pap(i,j,k,0); 
      p=p->next; 
      i=p->num; 
      j=p->m; 
      pap(i,j,k,12); 
      k+=3; 
      p=p->next; 
      ret=compar3(save); 
      fen(); 
      if(ret==1) 
goto end; 

      i=p->num; 
      j=p->m; 
      pap(i,j,k,0); 
      p=p->next; 
      i=p->num; 
      j=p->m; 
      pap(i,j,k,12); 
      ret=compar4(save); 
      fen(); 
      if(ret==1) 
goto end; 

      gotoxy(50,1); 
      printf("open your card!                 "); 
      gotoxy(50,2); 
      printf("                    "); 
      sleep(1); 
      clrscr(); 
      k=9; 
      p=save; 
      for(x=0;x<5;x++) 
      { 
i=p->num; 
j=p->m; 
pap(i,j,k,0); 
p=p->next; 
i=p->num; 
j=p->m; 
pap(i,j,k,12); 
k+=3; 
p=p->next; 
      } 
      fen(); 
      p=save; 
      compar5(p); 
     end: bet=0; 
 
  
   fen(); 
  gotoxy(50,4); 
  printf("continue the game?(y/n)      "); 
   ch=getch(); 
  } 
} 

void fen() 
{ 
  gotoxy(1,6); 
  printf("        "); 
  gotoxy(1,18); 
  printf("        "); 
  gotoxy(50,5); 
  printf("         "); 
  gotoxy(1,6); 
  printf("COM:%d",com); 
  gotoxy(1,18); 
  printf("YOU:%d",you); 
  gotoxy(50,5); 
  printf("TOTLE:%d   ",bet); 
} 


int compar1(struct face *p) 
{ 
  struct face *pt; 
  int i,ret,r=0,a[2],b[2]; 
  int comput1(int *,int *); 
  int speak(int,int); 
  pt=p; 

  /*jump the first two card*/ 

  for(i=0;i<2;i++) 
pt=pt->next; 

  a[0]=pt->num; 
  a[1]=pt->m; 
  pt=pt->next; 
  b[0]=pt->num; 
  b[1]=pt->m; 
  ret=comput1(a,b); 
  if(ret==2) 
  { 
    r=speak(1,1); 
    return(r); 
  } 
  if(ret==1) 
  { 
    r=speak(1,0); 
    return(r); 
  } 
  if(ret==0) 
  { 
    r=speak(2,1); 
    return(r); 
  } 
} 



int comput1(int *x,int *y) 
{ 
  int m; 
  float co,yo,t; 
      m=x[0]; 
  switch(x[1]) 
  { 
    case 6:  t=0.4;  break; 
    case 3:  t=0.3;  break; 
    case 5:  t=0.2;  break; 
    case 4:  t=0.1;  break; 
  } 
  co=m+t; 
       m=y[0]; 
  switch(y[1]) 
  { 
    case 6:  t=0.4;  break; 
    case 3:  t=0.3;  break; 
    case 5:  t=0.2;  break; 
    case 4:  t=0.1;  break; 
  } 
  yo=m+t; 
  if(co>yo) 
  { 
    if(co==14) 
      return(2); 
    else 
      return(1); 
  } 
  else 
       return(0); 
} 



int compar2(struct face *p) 
{ 
   struct face *pt; 
   int i,a[4],b[4],ret,r=0; 
   int comput2(int *,int *); 
   int speak(int,int); 
   pt=p; 
   for(i=0;i<2;i++) 
pt=pt->next; 
   a[0]=pt->num; 
   a[1]=pt->m; 
pt=pt->next; 
   b[0]=pt->num; 
   b[1]=pt->m; 
pt=pt->next; 
   a[2]=pt->num; 
   a[3]=pt->m; 
pt=pt->next; 
   b[2]=pt->num; 
   b[3]=pt->m; 
   ret=comput2(a,b); 
   if(ret==2) 
   { 
     r=speak(1,1); 
     return(r); 
   } 
   if(ret==1) 
   { 
     r=speak(1,0); 
     return(r); 
   } 
   if(ret==0) 
   { 
     r=speak(2,1); 
     return(r); 
   } 
} 


int comput2(int *x,int *y) 
{ 
  int k,p; 
  float co,yo; 
  float compu(int); 
  /*           */ 
  if(x[0]<x[2]) 
  { 
    k=x[0]; 
    x[0]=x[2]; 
    x[2]=k; 
    p=x[1]; 
    x[1]=x[3]; 
    x[3]=p; 
  } 
  if(y[0]<y[2]) 
  { 
    k=y[0]; 
    y[0]=y[2]; 
    y[2]=k; 
    p=y[1]; 
    y[1]=y[3]; 
    y[3]=p; 
  } 
  if(x[0]==x[2]) 
     co=(x[0]+compu(x[1])+x[2]+compu(x[3]))*1000; 
  if(y[0]==y[2]) 
     yo=(y[0]+y[2]+compu(y[1])+compu(y[3]))*1000; 

  if(x[0]!=x[2]) 
     co=x[0]+compu(x[1]); 
  if(y[0]!=y[2]) 
     yo=y[0]+compu(y[1]); 

     /*   compare    */ 
  if(co>yo&&co>=2000) 
     return(2); 
  else if(co>yo) 
     return(1); 
  else if(co<yo) 
     return(0); 
  if(co=yo) 
    { 
      if(x[1]==6||x[3]==6) 
 return(2); 
      if(y[1]==6||y[3]==6) 
 return(0); 
    } 
} 


int compar3(struct face *pt) 
{ 
  struct face *p; 
  int i,ret,r=0,a[6],b[6]; 
  int comput3(int *,int *); 
  int speak(int,int); 
  p=pt; 
  for(i=0;i<2;i++) 
p=p->next; 
  a[0]=p->num; 
  a[1]=p->m; 
p=p->next; 
  b[0]=p->num; 
  b[1]=p->m; 
p=p->next; 
  a[2]=p->num; 
  a[3]=p->m; 
p=p->next; 

   b[2]=p->num; 
  b[3]=p->m; 
p=p->next; 
  a[4]=p->num; 
  a[5]=p->m; 
p=p->next; 
  b[4]=p->num; 
  b[5]=p->m; 
  ret=comput3(a,b); 
  if(ret==2) 
  { 
    r=speak(1,1); 
    return(r); 
  } 
  if(ret==1) 
  { 
    r=speak(1,0); 
    return(r); 
  } 
  if(ret==0) 
  { 
    r=speak(2,1); 
    return(r); 
  } 
  else 
  { 
    r=speak(2,0); 
    return(r); 
  } 
} 


int comput3(int *x,int *y) 
{ 
   int k,p,i; 
   float yo=0,co=0,f1,f2,i1,i2; 
   float compu(int); 
   /* sort the x num */ 

   for(i=0;i<2;i++) 
   { 
    if(x[2]>x[0]) 
    { 
      k=x[0]; 
      p=x[1]; 
      x[0]=x[2]; 
      x[1]=x[3]; 
      x[2]=k; 
      x[3]=p; 
    } 
    if(x[4]>x[2]) 
    { 
      k=x[4]; 
      p=x[5]; 
      x[4]=x[2]; 
      x[5]=x[3]; 
      x[2]=k; 
      x[3]=p; 
    } 
   } 

   /* sort the y num */ 
   for(i=0;i<2;i++) 
   { 
     if(y[2]>y[0]) 
     { 
       k=y[0]; 
       p=y[1]; 
       y[0]=y[2]; 
       y[1]=y[3]; 
       y[2]=k; 
       y[3]=p; 
     } 
     if(y[4]>y[2]) 
     { 
       k=y[2]; 
       p=y[3]; 
       y[2]=y[4]; 
       y[3]=y[5]; 
       y[4]=k; 
       y[5]=p; 
     } 
   } 

   if((x[0]==x[2]+1)&&(x[0]==x[4]+2)) 
   { 
      if(x[1]==x[3]&&x[1]==x[5]) 
 co=5; 
      else 
 co=2; 
   } 
   else if(x[1]==x[3]&&x[1]==x[5]) 
 co=3; 
   if(x[0]==x[2]&&x[0]==x[4]) 
 co=4; 
   else if(x[0]==x[2]||x[2]==x[4]||x[0]==x[4]) 
 co=1; 

   if((y[0]==y[2]+1)&&(y[0]==y[4]+2)) 
   { 
      if(y[1]==y[3]&&y[1]==y[5]) 
 yo=5; 
      else 
 yo=2; 
   } 
   else if(y[1]==y[3]&&y[1]==y[5]) 
 yo=3; 
   if(y[0]==y[2]&&y[0]==y[4]) 
 yo=4; 
   else if(y[0]==y[2]||y[0]==y[4]||y[2]==y[4]) 
 yo=1; 


  /* begin to compare */ 
  if(co>yo) 
  { 
    if(co-yo>=3) 
      return(2); 
    else 
      return(1); 
  } 
  else if(co<yo) 
  { 
    if(yo-co>=3) 
      return(-1); 
    else 
      return(0); 
  } 
  else 
  { 
    if(co==5) 
    { 
      f1=x[0]+compu(x[1]); 
      f2=y[0]+compu(y[1]); 
      if(f1>f2) 
 return(1); 
      else 
 return(0); 
    } 
    if(co==4) 
    { 
      if(x[0]>y[0]) 
 return(1); 
      else 
 return(0); 
    } 
    if(co==3) 
    { 
      f1=x[0]+compu(x[1]); 
      f2=y[0]+compu(y[1]); 
      if(f1>f2) 
 return(1); 
      else 
 return(0); 
    } 
    if(co==2) 
    { 
      f1=x[0]+compu(x[1]); 
      f2=y[0]+compu(y[1]); 
      if(f1>f2) 
 return(1); 
      else 
 return(0); 
    } 
    if(co==1) 
    { 
      if(x[2]>y[2]) 
  return(1); 
      if(x[2]<y[2]) 
  return(0); 
      else 
      { 
 if(x[0]==x[2]) 
 { 
   f1=compu(x[1])+compu(x[2]); 
   i1=x[4]+compu(x[5]); 
 } 
 else 
 { 
   f1=compu(x[2])+compu(x[4]); 
   i1=x[0]+compu(x[1]); 
 } 
 if(y[0]==y[2]) 
 { 
   f2=compu(y[0])+compu(y[2]); 
   i2=x[4]+compu(x[5]); 
 } 
 else 
 { 
   f2=compu(y[2])+compu(y[4]); 
   i2=x[0]+compu(x[1]); 
 } 
     if(f1>f2) 
return(1); 
     if(f1<f2) 
return(0); 
     else 
     { 
if(i1>i2) 
  return(1); 
else 
  return(0); 
     } 
       } 
     } 
     if(co==0) 
     { 
       f1=x[0]+compu(x[1]); 
       f2=y[0]+compu(y[1]); 
 
        if(f1>f2) 
 return(1); 
       else 
 return(0); 
     } 
  } 
} 


int compar4(struct face *pt) 
{ 
  struct face *p; 
  int i,a[8],b[8],ret,r=0; 
  int comput4(int *,int*); 
  int speak(int,int); 
    p=pt; 
  for(i=0;i<2;i++) 
    p=p->next; 
  for(i=0;i<8;i+=2) 
  { 
     a[i]=p->num; 
     a[i+1]=p->m; 
     p=p->next; 
     b[i]=p->num; 
     b[i+1]=p->m; 
     p=p->next; 
  } 
  ret=comput4(a,b); 
  if(ret==2) 
  { 
    r=speak(1,1); 
    return(r); 
  } 
  if(ret==1) 
  { 
    r=speak(1,0); 
    return(r); 
  } 
  if(ret==0) 
  { 
    r=speak(2,1); 
    return(r); 
  } 
  else 
  { 
    r=speak(2,0); 
    return(r); 
  } 
} 


int comput4(int *x,int *y) 
{ 
  int k,i,j,p,q; 
  float yo=0,co=0,f1,f2,i1,i2; 
  float compu(int); 

  /* sort the x */ 
  for(i=0;i<8;i+=2) 
  { 
    k=i; 
    for(j=i+2;j<8;j+=2) 
       if(x[k]<x[j]) 
 k=j; 
    if(k!=i) 
    { 
      p=x[k]; 
      q=x[k+1]; 
      x[k]=x[i]; 
      x[k+1]=x[i+1]; 
      x[i]=p; 
      x[i+1]=q; 
    } 
  } 

  /* sort the y */ 
  for(i=0;i<8;i+=2) 
  { 
     k=i; 
     for(j=i+2;j<8;j+=2) 
       if(y[k]<y[j]) 
  k=j; 
     if(k!=i) 
     { 
       p=y[k]; 
       q=y[k+1]; 
       y[k]=y[i]; 
       y[k+1]=y[i+1]; 
       y[i]=p; 
       y[i+1]=q; 
     } 
  } 

  /*             */ 

  if((x[0]==x[2]+1)&&(x[0]==x[4]+2)&&(x[0]==x[6]+3)) 
  { 
     if(x[1]==x[3]&&x[1]==x[5]&&x[1]==x[7]) 
  co=7; 
     else 
  co=3; 
  } 
  else if(x[1]==x[3]&&x[1]==x[5]&&x[1]==x[7]) 
  co=4; 
  if(x[2]==x[4]) 
  { 
    if(x[0]==x[6]) 
co=6; 
    else if(x[0]==x[2]||x[6]==x[4]) 
co=5; 
    else 
co=1; 
  } 
  else if(x[0]==x[2]&&x[4]==x[6]) 
co=2; 
  else if(x[0]==x[2]||x[4]==x[6]) 
co=1; 


  if((y[0]==y[2]+1)&&(y[0]==y[4]+2)&&(y[0]==y[6]+3)) 
  { 
     if(y[1]==y[3]&&y[1]==y[5]&&y[1]==y[7]) 
yo=7; 
     else 
yo=3; 
  } 
  else if(y[1]==y[3]&&y[1]==y[5]&&y[1]==y[7]) 
yo=4; 
  if(y[2]==y[4]) 
  { 
    if(y[0]==y[6]) 
yo=6; 
    else if(y[0]==y[2]||y[6]==y[4]) 
yo=5; 
    else 
yo=1; 
  } 
  else if(y[0]==y[2]&&y[4]==y[6]) 
yo=2; 
  else if(y[0]==y[2]||y[4]==y[6]) 
yo=1; 

  /*   compare   */ 
  if(co>yo) 
  { 
    if(co-yo>=3) 
      return(2); 
    else 
      return(1); 
  } 
  else if(co<yo) 
  { 
    if(yo-co>=3) 
      return(-1); 
    else 
      return(0); 
  } 
  else 
  { 
    if(co==7) 
    { 
      f1=x[0]+compu(x[1]); 
      f2=y[0]+compu(y[1]); 
      if(f1>f2) 
  return(1); 
      else 
  return(0); 
    } 
    if(co==6) 
    { 
      if(x[0]>y[0]) 
 return(1); 
      else 
 return(0); 
    } 
    if(co==5) 
    { 
      if(x[2]>y[2]) 
 return(1); 
      else 
 return(0); 
    } 
    if(co==4) 
    { 
      f1=x[0]+compu(x[1]); 
      f2=y[0]+compu(y[1]); 
      if(f1>f2) 
 return(1); 
      else 
 return(0); 
    } 
    if(co==3) 
    { 
      f1=x[0]+compu(x[1]); 
      f2=y[0]+compu(y[1]); 
      if(f1>f2) 
 return(1); 
      else 
 return(0); 
    } 
    if(co==2) 
    { 
      i1=x[0]+compu(x[1]); 
      i2=x[2]+compu(x[3]); 
      f1=i1>i2?i1:i2; 
      i1=y[0]+compu(y[1]); 
      i2=y[2]+compu(y[3]); 
 
 

       f2=i1>i2?i1:i2; 
      if(f1>f2) 
 return(1); 
      else 
 return(0); 
    } 
    if(co==1) 
    { 
      if(x[0]==x[2]) 
      { 
i1=x[0]+compu(x[1]); 
i2=x[2]+compu(x[3]); 
f1=i1>i2?i1:i2; 
      } 
      else if(x[2]==x[4]) 
      { 
i1=x[2]+compu(x[3]); 
i2=x[4]+compu(x[5]); 
f1=i1>i2?i1:i2; 
      } 
      else 
      { 
i1=x[4]+compu(x[5]); 
i2=x[6]+compu(x[7]); 
f1=i1>i2?i1:i2; 
      } 
      if(y[0]==y[2]) 
      { 
i1=y[0]+compu(y[1]); 
i2=y[2]+compu(y[3]); 
f2=i1>i2?i1:i2; 
      } 
      else if(y[2]==y[4]) 
      { 
i1=y[2]+compu(y[3]); 
i2=y[4]+compu(y[5]); 
f2=i1>i2?i1:i2; 
      } 
      else 
      { 
i1=y[4]+compu(y[5]); 
i2=y[6]+compu(y[7]); 
f2=i1>i2?i1:i2; 
      } 
      if(f1>f2) 
  return(1); 
      else 
  return(0); 
    } 
    else 
    { 
      f1=x[0]+compu(x[1]); 
      f2=y[0]+compu(y[1]); 
      if(f1>f2) 
 return(1); 
      else 
 return(0); 
    } 
  } 
} 

void compar5(struct face *pt) 
{ 
  struct face *p; 
  int ret,i,a[10],b[10]; 
  p=pt; 
  for(i=0;i<10;i+=2) 
  { 
    a[i]=p->num; 
    a[i+1]=p->m; 
    p=p->next; 
    b[i]=p->num; 
    b[i+1]=p->m; 
    p=p->next; 
  } 
  ret=comput5(a,b); 
  if(ret==1) 
  { 
    gotoxy(50,1); 
    printf("the computer win!             "); 
    com=com+bet; 
  } 
  else 
  { 
    gotoxy(50,1); 
    printf("you win!                      "); 
    you=you+bet; 
  } 
} 


int comput5(int *x,int *y) 
{ 
  int k,i,j,p,q; 
  float co=0,yo=0,f1,f2,i1,i2; 
  float compu(int); 

  /*  sort the x  */ 
  for(i=0;i<10;i+=2) 
  { 
    k=i; 
    for(j=k+2;j<10;j+=2) 
      if(x[k]<x[j]) 
k=j; 
    if(k!=i) 
    { 
      p=x[k]; 
      q=x[k+1]; 
      x[k]=x[i]; 
      x[k+1]=x[i+1]; 
      x[i]=p; 
      x[i+1]=q; 
    } 
  } 

  /*  sort the y  */ 
  for(i=0;i<10;i+=2) 
  { 
     k=i; 
    for(j=k+2;j<10;j+=2) 
      if(y[k]<y[j]) 
k=j; 
    if(k!=i) 
    { 
      p=y[k]; 
      q=y[k+1]; 
      y[k]=y[i]; 
      y[k+1]=y[i+1]; 
      y[i]=p; 
      y[i+1]=q; 
    } 
  } 

  if((x[0]==x[2]+1)&&(x[0]==x[4]+2)&&(x[0]==x[6]+3)&&(x[0]==x[8]+4)) 
  { 
    if(x[1]==x[3]&&x[1]==x[5]&&x[1]==x[7]&&x[1]==x[9]) 
co=8; 
    else 
co=4; 
  } 
  else if(x[1]==x[3]&&x[1]==x[5]&&x[1]==x[7]&&x[1]==x[9]) 
co=5; 
  if(x[2]==x[4]&&x[2]==x[6]) 
  { 
    if(x[0]==x[2]||x[8]==x[6]) 
co=7; 
    else 
co=3; 
  } 
  else if(x[0]==x[2]&&x[0]==x[4]) 
  { 
    if(x[6]==x[8]) 
co=6; 
    else 
co=3; 
  } 
  else if(x[8]==x[6]&&x[8]==x[4]) 
  { 
    if(x[0]==x[2]) 
co=6; 
    else 
co=3; 
  } 
  else if((x[0]==x[2]&&x[4]==x[6])||(x[0]==x[2]&&x[6]==x[8])||(x[2]==x[4]&&x[6]==x[8])) 
co=2; 
  else if(x[0]==x[2]||x[2]==x[4]||x[4]==x[6]||x[6]==x[8]) 
co=1; 
  if((y[0]==y[2]+1)&&(y[0]==y[4]+2)&&(y[0]==y[6]+3)&&(y[0]==y[8]+4)) 
  { 
     if(y[1]==y[3]&&y[1]==y[5]&&y[1]==y[7]&&y[1]==y[9]) 
yo=8; 
     else 
yo=4; 
  } 
  else if(y[1]==y[3]&&y[1]==y[5]&&y[1]==y[7]&&y[1]==y[9]) 
yo=5; 
  if(y[2]==y[4]&&y[2]==y[6]) 
  { 
     if(y[0]==y[2]||y[6]==y[8]) 
yo=7; 
     else 
yo=3; 
  } 
  else if(y[0]==y[2]&&y[0]==y[4]) 
  { 
     if(y[6]==y[8]) 
yo=6; 
 

      else 
yo=3; 
  } 
  else if(y[8]==y[6]&&y[8]==y[4]) 
  { 
     if(y[0]==y[2]) 
yo=6; 
     else 
yo=3; 
  } 
  else if((y[0]==y[2]&&y[4]==y[6])||(y[0]==y[2]&&y[6]==y[8])||(y[2]==y[4]&&y[6]==y[8])) 
yo=2; 
  else if(y[0]==y[2]||y[2]==y[4]||y[4]==y[6]||y[6]==y[8]) 
yo=1; 

  /*   compare   */ 
  if(co>yo) 
    return(1); 
  if(co<yo) 
    return(0); 
  else 
  { 
    if(co==8) 
    { 
      f1=x[0]+compu(x[1]); 
      f2=y[0]+compu(y[1]); 
      if(f1>f2) 
return(1); 
      else 
return(0); 
    } 
    if(co==7) 
    { 
      if(x[2]>y[2]) 
return(1); 
      else 
return(0); 
    } 
    if(co==6) 
    { 
      if(x[4]>y[4]) 
return(1); 
      else 
return(0); 
    } 
    if(co==5) 
    { 
      f1=x[0]+compu(x[1]); 
      f2=y[0]+compu(y[1]); 
      if(f1>f2) 
return(1); 
      else 
return(0); 
    } 
    if(co==4) 
    { 
      f1=x[0]+compu(x[1]); 
      f2=y[0]+compu(y[1]); 
      if(f1>f2) 
return(1); 
      else 
return(0); 
    } 
    if(co==3) 
    { 
      if(x[4]>y[4]) 
return(1); 
      else 
return(0); 
    } 
    if(co==2) 
    { 
      if(x[2]>y[2]) 
return(1); 
      if(x[2]<y[2]) 
return(0); 
      else 
      { 
if(x[6]>y[6]) 
  return(1); 
if(x[6]<y[6]) 
  return(0); 
else 
{ 
  if(x[0]==x[2]) 
    f1=compu(x[1])>compu(x[3])?compu(x[1]):compu(x[3]); 
  else 
    f1=compu(x[3])>compu(x[5])?compu(x[3]):compu(x[5]); 
  if(y[0]==y[2]) 
    f2=compu(y[1])>compu(y[3])?compu(y[1]):compu(y[3]); 
  else 
    f2=compu(y[3])>compu(y[5])?compu(y[3]):compu(y[5]); 
     if(f1>f2) 
       return(1); 
     else 
       return(0); 
} 
      } 
    } 
    if(co==1) 
    { 
      if(x[0]==x[2]) 
f1=x[0]+(compu(x[1])>compu(x[3])?compu(x[1]):compu(x[3])); 
      else if(x[2]==x[4]) 
f1=x[4]+(compu(x[3])>compu(x[5])?compu(x[3]):compu(x[5])); 
      else if(x[4]==x[6]) 
f1=x[6]+(compu(x[5])>compu(x[7])?compu(x[5]):compu(x[7])); 
      else 
f1=x[8]+(compu(x[7])>compu(x[9])?compu(x[7]):compu(x[9])); 
      if(y[0]==y[2]) 
f2=y[0]+(compu(y[1])>compu(y[3])?compu(y[1]):compu(y[3])); 
      else if(y[2]==y[4]) 
f2=y[4]+(compu(y[3])>compu(y[5])?compu(y[3]):compu(y[5])); 
      else if(y[4]==y[6]) 
f2=y[6]+(compu(y[5])>compu(y[7])?compu(y[5]):compu(y[7])); 
      else 
f2=y[8]+(compu(y[7])>compu(y[9])?compu(y[7]):compu(y[9])); 
      if(f1>f2) 
return(1); 
      else 
return(0); 
    } 
    else 
    { 
      f1=x[0]+compu(x[1]); 
      f2=y[0]+compu(y[1]); 
      if(f1>f2) 
return(1); 
      else 
return(0); 
    } 
  } 
} 



float compu(int x) 
{ 
  float f; 
    switch(x) 
     { 
       case 6: f=0.4;  break; 
       case 3: f=0.3;  break; 
       case 5: f=0.2;  break; 
       case 4: f=0.1;  break; 
     } 
 return(f); 
} 


int speak(int x,int y) 
{ 
  int score1,score2; 
  char ch='y'; 
  randomize(); 
  gotoxy(50,1); 
  printf("                              "); 
  gotoxy(50,2); 
  printf("                              "); 
  switch(x) 
  { 
    case 1: 
      { 
if(y==1) 
  score1=(random(4)+2)*100; 
if(y==0) 
  score1=random(13)*10; 
com=com-score1; 
bet=bet+score1; 
  
 gotoxy(50,1); 
printf("the computer bet %d,you keep? ",score1); 
ch=getch(); 
   if(ch!='n') 
   { 
     you=you-score1; 
     bet=bet+score1; 
     gotoxy(50,2); 
     printf("you keep!                    "); 
     sleep(1); 
     return(0); 
   } 
   else 
   { 
     gotoxy(50,2); 
     printf("you give up!                 "); 
     sleep(1); 
     com=com+bet; 
     return(1); 
   } 
      }   break; 
    case 2: 
      { 
gotoxy(50,1); 
printf("you big!how much do you bet?  "); 
gotoxy(50,2); 
do 
{ 
  scanf("%d",&score2); 
  if(score2<0) 
  { 
    gotoxy(50,1); 
    printf("error,input again           "); 
  } 
}while(score2<0); 
you=you-score2; 
if(y==1) 
{ 
  com=com-score2; 
  bet=bet+2*score2; 
  gotoxy(50,2); 
  printf("the computer keep!       "); 
  sleep(1); 
  return(0); 
} 
else 
{ 
  bet=bet+score2; 
  you=you+bet; 
  gotoxy(50,2); 
  printf("the conputer give up!     "); 
  sleep(1); 
  return(1); 
} 
      } 
  } 
} 

void serve() 
{ 
   void devide(); 
   struct face *p; 
   int i,j,k; 
   p=card; 
   for(i=0;i<51;i++) 
       { 
 p->next=p+1; 
 p=p->next; 
       } 
       p->next=card; 
   p=save; 
   for(i=0;i<9;i++) 
       { 
 p->next=p+1; 
 p=p->next; 
       } 
     p->next=save; 
     p=card; 
   for(i=2;i<15;i++) 
     for(j=3;j<7;j++) 
       { 
 p->num=i; 
 p->m=j; 
 p=p->next; 
       } 
       n=0; 
   for(i=0;i<5;i++) 
     devide(); 
} 

void devide() 
{ 
  struct face *p,*p1,*p2; 
  int i,r1,r2; 
      p0=card; 
  randomize(); 
  r1=random(30); 
  r2=random(30); 
  p1=p2=p0; 
  for(i=0;i<r1;i++) 
p1=p1->next; 
  for(i=0;i<r2;i++) 
p2=p2->next; 
  p=save; 
  if(n!=0) 
  for(i=0;i<n;i++) 
  p=p->next; 
  while(p1->num==0) 
     for(i=0;i<random(25);i++) 
  p1=p1->next; 
      p->num=p1->num; 
      p->m=p1->m; 
      p1->num=0; 
  while(p2->num==0) 
     for(i=0;i<random(25);i++) 
  p2=p2->next; 
      p=p->next; 
      p->num=p2->num; 
      p->m=p2->m; 
      p2->num=0; 
n+=2; 
} 


void puke1() 
{ 
 void title3(); 
 void title2(); 
 void title1(); 
 void title0(); 
 while(!kbhit()) 
 { 
   title0(); 
sleep(1); 
   title1(); 
sleep(1); 
   title2(); 
sleep(1); 
   title3(); 
sleep(1); 
 } 
} 

void title3() 
{ 
 void star(int,int); 
 void name(); 
 star(1,3); 
 textbackground(3); 
 gotoxy(10,2); 
 cprintf("\3    *******     ***     ***  ***    ****  ***********    \3\n"); 
 gotoxy(10,3); 
 cprintf("       *******    **     **    **   ***     **********     \n"); 
 gotoxy(10,4); 
 cprintf("\4      **    **   **     **    **   **      **       *    \4\n"); 
 gotoxy(10,5); 
 cprintf("       **    **   **     **    **  **       **             \n"); 
 gotoxy(10,6); 
 cprintf("\5      **    **   **     **    ** **        **            \5\n"); 
 gotoxy(10,7); 
 cprintf("       **  ***    **     **    ** *         **     *       \n"); 
 gotoxy(10,8); 
 cprintf("\6      *****      **     **    ***          ********      \6\n"); 
 gotoxy(10,9); 
 cprintf("       **         **     **    ** *         **     *       \n"); 
  
  gotoxy(10,10); 
 cprintf("\3      **         **     **    ** **        **            \3\n"); 
 gotoxy(10,11); 
 cprintf("       **         **     **    **  **       **             \n"); 
 gotoxy(10,12); 
 cprintf("\4      **          *     *     **   **      **       *    \4\n"); 
 gotoxy(10,13); 
 cprintf("       **          *     *     **   ***     **********     \n"); 
 gotoxy(10,14); 
 cprintf("\5     ****          *****     ***    ****  ***********    \5\n"); 
 star(15,3); 
 name(); 
} 


void title2() 
{ 
   void name(); 
   void star(int,int); 
 star(1,14); 
 gotoxy(10,2); 
 cprintf("\3    *******     ***     ***  ***    ****                 \3\n"); 
 gotoxy(10,3); 
 cprintf("       *******    **     **    **   ***                    \n"); 
 gotoxy(10,4); 
 cprintf("\4      **    **   **     **    **   **                    \4\n"); 
 gotoxy(10,5); 
 cprintf("       **    **   **     **    **  **                      \n"); 
 gotoxy(10,6); 
 cprintf("\5      **    **   **     **    ** **                      \5\n"); 
 gotoxy(10,7); 
 cprintf("       **  ***    **     **    ** *                        \n"); 
 gotoxy(10,8); 
 cprintf("\6      *****      **     **    ***                        \6\n"); 
 gotoxy(10,9); 
 cprintf("       **         **     **    ** *                        \n"); 
 gotoxy(10,10); 
 cprintf("\3      **         **     **    ** **                      \3\n"); 
 gotoxy(10,11); 
 cprintf("       **         **     **    **  **                      \n"); 
 gotoxy(10,12); 
 cprintf("\4      **          *     *     **   **                    \4\n"); 
 gotoxy(10,13); 
 cprintf("       **          *     *     **   ***                    \n"); 
 gotoxy(10,14); 
 cprintf("\5     ****          *****     ***    ****                 \5\n"); 
   star(15,14); 
   name(); 
} 


void title1() 
{ 
  void name(); 
  void star(int,int); 
  star(1,4); 
  textbackground(4); 
  gotoxy(10,2); 
 cprintf("\3    *******     ***     ***                              \3\n"); 
 gotoxy(10,3); 
 cprintf("       *******    **     **                                \n"); 
 gotoxy(10,4); 
 cprintf("\4      **    **   **     **                               \4\n"); 
 gotoxy(10,5); 
 cprintf("       **    **   **     **                                \n"); 
 gotoxy(10,6); 
 cprintf("\5      **    **   **     **                               \5\n"); 
 gotoxy(10,7); 
 cprintf("       **  ***    **     **                                \n"); 
 gotoxy(10,8); 
 cprintf("\6      *****      **     **                               \6\n"); 
 gotoxy(10,9); 
 cprintf("       **         **     **                                \n"); 
 gotoxy(10,10); 
 cprintf("\3      **         **     **                               \3\n"); 
 gotoxy(10,11); 
 cprintf("       **         **     **                                \n"); 
 gotoxy(10,12); 
 cprintf("\4      **          *     *                                \4\n"); 
 gotoxy(10,13); 
 cprintf("       **          *     *                                 \n"); 
 gotoxy(10,14); 
 cprintf("\5     ****          *****                                 \5\n");  
  star(15,4); 
  name(); 
} 


void title0() 
{ 
  void name(); 
  void star(int,int); 
   star(1,2); 
 textbackground(2); 
 gotoxy(10,2); 
 cprintf("\3    *******                                              \3\n"); 
 gotoxy(10,3); 
 cprintf("       *******                                             \n"); 
 gotoxy(10,4); 
 cprintf("\4      **    **                                           \4\n"); 
 gotoxy(10,5); 
 cprintf("       **    **                                            \n"); 
 gotoxy(10,6); 
 cprintf("\5      **    **                                           \5\n"); 
 gotoxy(10,7); 
 cprintf("       **  ***                                             \n"); 
 gotoxy(10,8); 
 cprintf("\6      *****                                              \6\n"); 
 gotoxy(10,9); 
 cprintf("       **                                                  \n"); 
 gotoxy(10,10); 
 cprintf("\3      **                                                 \3\n"); 
 gotoxy(10,11); 
 cprintf("       **                                                  \n"); 
 gotoxy(10,12); 
 cprintf("\4      **                                                 \4\n"); 
 gotoxy(10,13); 
 cprintf("       **                                                  \n"); 
 gotoxy(10,14); 
 cprintf("\5     ****                                                \5\n"); 
   star(15,2); 
   name(); 
} 


void pap(int x,int y,int z,int w) 
{ 
 int i,j; 
 switch(x) 
{ 
case 14: 
{ 
 if(y==6) 
 { 
  gotoxy(z,w+1); 
  printf("_______________\n");gotoxy(z,w+2); 
  printf("|A            |\n");gotoxy(z,w+3); 
  printf("|%c     *      |\n",6);gotoxy(z,w+4); 
  printf("|     ***     |\n");gotoxy(z,w+5); 
  printf("|    *****    |\n");gotoxy(z,w+6); 
  printf("|   *******   |\n");gotoxy(z,w+7); 
  printf("|  *********  |\n");gotoxy(z,w+8); 
  printf("| *********** |\n");gotoxy(z,w+9); 
  printf("|  **  *  **  |\n");gotoxy(z,w+10); 
  printf("|      *      |\n");gotoxy(z,w+11); 
  printf("|     ***    %c|\n",6);gotoxy(z,w+12); 
  printf("|____________A|\n"); 
 } 
 else if(y==3) 
 { 
  gotoxy(z,w+1); 
  printf("_______________\n");gotoxy(z,w+2); 
  printf("|A            |\n");gotoxy(z,w+3); 
  printf("|%c  *     *   |\n",3);gotoxy(z,w+4); 
  printf("|  ***   ***  |\n");gotoxy(z,w+5); 
  printf("| ***** ***** |\n");gotoxy(z,w+6); 
  printf("| *********** |\n");gotoxy(z,w+7); 
  printf("|  *********  |\n");gotoxy(z,w+8); 
  printf("|   *******   |\n");gotoxy(z,w+9); 
  printf("|    *****    |\n");gotoxy(z,w+10); 
  printf("|     ***     |\n");gotoxy(z,w+11); 
  printf("|      *     %c|\n",3);gotoxy(z,w+12); 
  printf("|____________A|\n"); 
 } 
 else if(y==5) 
 { 
  gotoxy(z,w+1); 
  printf("_______________\n");gotoxy(z,w+2); 
  printf("|A            |\n");gotoxy(z,w+3); 
  printf("|%c    ***     |\n",5);gotoxy(z,w+4); 
  printf("|    *****    |\n");gotoxy(z,w+5); 
  printf("|   *******   |\n");gotoxy(z,w+6); 
  printf("|    *****    |\n");gotoxy(z,w+7); 
  printf("| *********** |\n");gotoxy(z,w+8); 
  printf("|*****   *****|\n");gotoxy(z,w+9); 
  printf("| ****   **** |\n");gotoxy(z,w+10);  
  printf("|     ***     |\n");gotoxy(z,w+11); 
  printf("|     ***    %c|\n",5);gotoxy(z,w+12); 
  printf("|____________A|\n"); 
 } 
 else if(y==4) 
 { 
  gotoxy(z,w+1); 
  printf("_______________\n");gotoxy(z,w+2); 
  printf("|A            |\n");gotoxy(z,w+3); 
  printf("|%c     *      |\n",4);gotoxy(z,w+4); 
  printf("|     ***     |\n");gotoxy(z,w+5); 
  printf("|    *****    |\n");gotoxy(z,w+6); 
  printf("|   *******   |\n");gotoxy(z,w+7); 
  printf("|  *********  |\n");gotoxy(z,w+8); 
  printf("|   *******   |\n");gotoxy(z,w+9); 
  printf("|    *****    |\n");gotoxy(z,w+10); 
  printf("|     ***     |\n");gotoxy(z,w+11); 
  printf("|      *     %c|\n",4);gotoxy(z,w+12); 
  printf("|____________A|\n"); 
 } 
}  break; 
case 2: 
 { 
  gotoxy(z,w+1); 
  printf("_______________\n");gotoxy(z,w+2); 
  printf("|2            |\n");gotoxy(z,w+3); 
  printf("|%c            |\n",y);gotoxy(z,w+4); 
  printf("|      %c      |\n",y);gotoxy(z,w+5); 
  printf("|             |\n");gotoxy(z,w+6); 
  printf("|             |\n");gotoxy(z,w+7); 
  printf("|             |\n");gotoxy(z,w+8); 
  printf("|             |\n");gotoxy(z,w+9); 
  printf("|             |\n");gotoxy(z,w+10); 
  printf("|      %c      |\n",y);gotoxy(z,w+11); 
  printf("|            %c|\n",y);gotoxy(z,w+12); 
  printf("|____________2|\n"); 
 } break; 
case 3: 
 { 
  gotoxy(z,w+1); 
  printf("_______________\n");gotoxy(z,w+2); 
  printf("|3            |\n");gotoxy(z,w+3); 
  printf("|%c            |\n",y);gotoxy(z,w+4); 
  printf("|      %c      |\n",y);gotoxy(z,w+5); 
  printf("|             |\n");gotoxy(z,w+6); 
  printf("|             |\n");gotoxy(z,w+7); 
  printf("|      %c      |\n",y);gotoxy(z,w+8); 
  printf("|             |\n");gotoxy(z,w+9); 
  printf("|             |\n");gotoxy(z,w+10); 
  printf("|      %c      |\n",y);gotoxy(z,w+11); 
  printf("|            %c|\n",y);gotoxy(z,w+12); 
  printf("|____________3|\n"); 
 }  break; 
case 4: 
 { 
  gotoxy(z,w+1); 
  printf("_______________\n");gotoxy(z,w+2); 
  printf("|4            |\n");gotoxy(z,w+3); 
  printf("|%c            |\n",y);gotoxy(z,w+4); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+5); 
  printf("|             |\n");gotoxy(z,w+6); 
  printf("|             |\n");gotoxy(z,w+7); 
  printf("|             |\n");gotoxy(z,w+8); 
  printf("|             |\n");gotoxy(z,w+9); 
  printf("|             |\n");gotoxy(z,w+10); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+11); 
  printf("|            %c|\n",y);gotoxy(z,w+12); 
  printf("|____________4|\n"); 
 }  break; 
case 5: 
 { 
  gotoxy(z,w+1); 
  printf("_______________\n");gotoxy(z,w+2); 
  printf("|5            |\n");gotoxy(z,w+3); 
  printf("|%c            |\n",y);gotoxy(z,w+4); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+5); 
  printf("|             |\n");gotoxy(z,w+6); 
  printf("|             |\n");gotoxy(z,w+7); 
  printf("|      %c      |\n",y);gotoxy(z,w+8); 
  printf("|             |\n");gotoxy(z,w+9); 
  printf("|             |\n");gotoxy(z,w+10); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+11); 
  printf("|            %c|\n",y);gotoxy(z,w+12);  
  printf("|____________5|\n"); 
 }  break; 
case 6: 
 { 
  gotoxy(z,w+1); 
  printf("_______________\n");gotoxy(z,w+2); 
  printf("|6            |\n");gotoxy(z,w+3); 
  printf("|%c            |\n",y);gotoxy(z,w+4); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+5); 
  printf("|             |\n");gotoxy(z,w+6); 
  printf("|             |\n");gotoxy(z,w+7); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+8); 
  printf("|             |\n");gotoxy(z,w+9); 
  printf("|             |\n");gotoxy(z,w+10); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+11); 
  printf("|            %c|\n",y);gotoxy(z,w+12); 
  printf("|____________6|\n"); 
 }  break; 
case 7: 
 { 
  gotoxy(z,w+1); 
  printf("_______________\n");gotoxy(z,w+2); 
  printf("|7            |\n");gotoxy(z,w+3); 
  printf("|%c            |\n",y);gotoxy(z,w+4); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+5); 
  printf("|      %c      |\n",y);gotoxy(z,w+6); 
  printf("|             |\n");gotoxy(z,w+7); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+8); 
  printf("|             |\n");gotoxy(z,w+9); 
  printf("|             |\n");gotoxy(z,w+10); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+11); 
  printf("|            %c|\n",y);gotoxy(z,w+12); 
  printf("|____________7|\n"); 
 }  break; 
case 8: 
 { 
  gotoxy(z,w+1); 
  printf("_______________\n");gotoxy(z,w+2); 
  printf("|8            |\n");gotoxy(z,w+3); 
  printf("|%c            |\n",y);gotoxy(z,w+4); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+5); 
  printf("|             |\n");gotoxy(z,w+6); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+7); 
  printf("|             |\n");gotoxy(z,w+8); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+9); 
  printf("|             |\n");gotoxy(z,w+10); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+11); 
  printf("|            %c|\n",y);gotoxy(z,w+12); 
  printf("|____________8|\n"); 
 }  break; 
case 9: 
 { 
  gotoxy(z,w+1); 
  printf("_______________\n");gotoxy(z,w+2); 
  printf("|9            |\n");gotoxy(z,w+3); 
  printf("|%c            |\n",y);gotoxy(z,w+4); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+5); 
  printf("|             |\n");gotoxy(z,w+6); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+7); 
  printf("|      %c      |\n",y);gotoxy(z,w+8); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+9); 
  printf("|             |\n");gotoxy(z,w+10); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+11); 
  printf("|            %c|\n",y);gotoxy(z,w+12); 
  printf("|____________9|\n"); 
 }  break; 
case 10: 
 { 
  gotoxy(z,w+1); 
  printf("_______________\n");gotoxy(z,w+2); 
  printf("|10           |\n");gotoxy(z,w+3); 
  printf("|%c            |\n",y);gotoxy(z,w+4); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+5); 
  printf("|      %c      |\n",y);gotoxy(z,w+6); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+7); 
  printf("|             |\n");gotoxy(z,w+8); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+9); 
  printf("|      %c      |\n",y);gotoxy(z,w+10); 
  printf("|   %c     %c   |\n",y,y);gotoxy(z,w+11); 
  printf("|            %c|\n",y);gotoxy(z,w+12); 
  printf("|___________10|\n"); 
 }  break; 
case 11: 
 { 
  gotoxy(z,w+1); 
  printf("_______________\n");gotoxy(z,w+2); 
  printf("|J            |\n");gotoxy(z,w+3); 
  printf("|%c *********  |\n",y);gotoxy(z,w+4); 
  printf("|  *********  |\n");gotoxy(z,w+5); 
  printf("|     ***     |\n");gotoxy(z,w+6); 
  printf("|     ***     |\n");gotoxy(z,w+7); 
  printf("|     ***     |\n");gotoxy(z,w+8); 
  printf("|     ***     |\n");gotoxy(z,w+9); 
  printf("|  *  ***     |\n");gotoxy(z,w+10); 
  printf("|   ****      |\n");gotoxy(z,w+11); 
  printf("|    **      %c|\n",y);gotoxy(z,w+12); 
  printf("|____________J|\n"); 
 }  break; 
case 12: 
 { 
  gotoxy(z,w+1); 
  printf("_______________\n");gotoxy(z,w+2); 
  printf("|Q            |\n");gotoxy(z,w+3); 
  printf("|%c   *****    |\n",y);gotoxy(z,w+4); 
  printf("|   **   **   |\n");gotoxy(z,w+5); 
  printf("|  **     **  |\n");gotoxy(z,w+6); 
  printf("|  **     **  |\n");gotoxy(z,w+7); 
  printf("|  **     **  |\n");gotoxy(z,w+8); 
  printf("|  **  ** **  |\n");gotoxy(z,w+9); 
  printf("|   **  ***   |\n");gotoxy(z,w+10); 
  printf("|    ***** ** |\n");gotoxy(z,w+11); 
  printf("|            %c|\n",y);gotoxy(z,w+12); 
  printf("|____________Q|\n"); 
 }  break; 
case 13: 
 { 
  gotoxy(z,w+1); 
  printf("_______________\n");gotoxy(z,w+2); 
  printf("|K            |\n");gotoxy(z,w+3); 
  printf("|%c ***   ***  |\n",y);gotoxy(z,w+4); 
  printf("|   **  ***   |\n");gotoxy(z,w+5); 
  printf("|   ** **     |\n");gotoxy(z,w+6); 
  printf("|   ** *      |\n");gotoxy(z,w+7); 
  printf("|   ***       |\n");gotoxy(z,w+8); 
  printf("|   ** *      |\n");gotoxy(z,w+9); 
  printf("|   ** **     |\n");gotoxy(z,w+10); 
  printf("|   **  ***   |\n");gotoxy(z,w+11); 
  printf("|  ***   *** %c|\n",y);gotoxy(z,w+12); 
  printf("|____________K|\n"); 
 }  break; 
default: 
 { 
  gotoxy(z,w+1); 
  printf("_______________\n"); 
  for(j=0;j<10;j++) 
  { 
   gotoxy(z,w+j+2); 
   printf("|"); 
   for(i=0;i<13;i++) 
     printf("%c",29); 
   printf("|\n"); 
  } 
  gotoxy(z,w+12); 
  printf("|_____________|\n"); 
 }  break; 
} 
} 


void name() 
{ 
   int i; 
   for(i=0;i<5;i++) 
printf("\n"); 
   gotoxy(38,21); 
   printf("1 PLAY"); 
   gotoxy(38,22); 
   printf("2 QUIT"); 
   printf("\n"); 
   gotoxy(32,24); 
   printf("Made by WeiZenghui\n"); 
} 


void star(int x,int y) 
{ 
   int i; 
   gotoxy(10,x); 
   textbackground(y); 
   cprintf("%c %c %c %c ",3,4,5,6); 
   for(i=0;i<6;i++) 
   cprintf("%c %c %c %c ",3,4,5,6); 
   cprintf("%c %c\n",3,4); 
}  
 
